﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using TrainigWorkshop.DAL_EF;
using TrainigWorkshop.Model;
using TrainigWorkshop.Contract;


namespace TrainigWorkshop.Service
{
    public class ProjectBService : IProjectBService
    {
        public static IFactory ifactory =new Factory();
        public List<Grade> GetAllClassInfo()
        {
            IClassRespository classRespository = ifactory.CreateClassRespository();
            List<Grade> classList = classRespository.GetClassInfo();
            return classList;
        }

        public List<StudentModel> GetAllStudentInfo()
        {
            IStudentRespository studentModelRespository = ifactory.CreateStudentRespository();
            List<StudentModel> studentModel = studentModelRespository.GetStudentInfo();
            return studentModel;

        }

        public void InsertStudentInfo(StudentModel student)
        {
           IStudentRespository studentRespository = ifactory.CreateStudentRespository();
           studentRespository.InsertStudentInfo(student); 
        }

        public void UpdateStudentInfo(StudentModel student)
        {
            IStudentRespository studentRespository = ifactory.CreateStudentRespository();
            studentRespository.UpdateStudentInfo(student);
        }

        public StudentModel GetStudentInfoById(int id)
        {
            IStudentRespository studentRespository = ifactory.CreateStudentRespository();

            StudentModel result = studentRespository.GetStudentInfoById(id);

            //business

            return result;
        }
        public void DeleteStudentInfo(int id)
        {
            IStudentRespository studentRespository = ifactory.CreateStudentRespository();
            studentRespository.DeleteStudentInfo(id);
        }

    }
}
